USE Partitioning;
GO

-- check filegroup for table dbo.Nums
SELECT
	ds.name,
	i.type_desc
FROM sys.data_spaces ds
	INNER JOIN sys.indexes i ON i.object_id = OBJECT_ID('dbo.Nums')
	AND i.index_id IN (0,1) -- heap/clustered index only
	AND i.data_space_id = ds.data_space_id;
GO

-- drop the constraint and move data to new filegroup
ALTER TABLE dbo.Nums DROP CONSTRAINT PK_Nums WITH (MOVE TO [SECONDARY]);
GO

-- check filegroup
SELECT
	ds.name,
	i.type_desc
FROM sys.data_spaces ds
	INNER JOIN sys.indexes i ON i.object_id = OBJECT_ID('dbo.Nums')
	AND i.index_id IN (0,1) -- heap/clustered index only
	AND i.data_space_id = ds.data_space_id;
GO

-- recreate clustered index
ALTER TABLE dbo.Nums ADD CONSTRAINT PK_Nums PRIMARY KEY CLUSTERED 
(
	[n] ASC
)
ON [SECONDARY];
GO